<!--
    THIS EXAMPLE WAS DOWNLOADED FROM https://echarts.apache.org/examples/zh/editor.html?c=bar-label-rotation
-->
<!DOCTYPE html>
<html style="height: 100%">

<head>
    <meta charset="utf-8">
</head>

<body style="height: 100%; margin: 0">
    <div id="container" style="height: 100%"></div>


    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.3.0/dist/echarts.min.js"></script>
    <script src="{{ url_for('static',filename='js/jquery-2.1.1.min.js') }}"></script>
    <!-- Uncomment this line if you want to dataTool extension
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.3.0/dist/extension/dataTool.min.js"></script>
        -->
    <!-- Uncomment this line if you want to use gl extension
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
        -->
    <!-- Uncomment this line if you want to echarts-stat extension
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
        -->
    <!-- Uncomment this line if you want to use map
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.3.0/map/js/china.js"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.3.0/map/js/world.js"></script>
        -->
    <!-- Uncomment these two lines if you want to use bmap extension
        <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<Your Key Here>"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@{{version}}/dist/extension/bmap.min.js"></script>
        -->

    <script type="text/javascript">
        $(document).ready(function() {
            limit2_sort()
        });

        // 获取连板接力股数据
        function limit2_sort() {
            $.ajax({
                url: '/limit2_sort',
                data: {},
                type: 'POST',
                async: false,
                dataType: 'json',
                success: function(data) {
                    run_echarts(data['data'])
                },
                error: function(msg) {
                    console.log(msg)
                }
            })
        };

        //处理数据
        function decode_data(data) {
            console.log(data)
            var m_array = []
            var m_data = []
            var m_name = []

            for (var i = 0; i < data.length; i++) {
                m_array.push(data[i][0])
                m_name.push(data[i][1])
                m_data.push(data[i][3])
            }
            return {
                dimensions: m_array,
                source: m_data,
                name: m_name
            }
        }

        function run_echarts(data) {
            var dom = document.getElementById("container");
            var myChart = echarts.init(dom);
            var app = {};

            var option;



            option = {
                dataset: {
                    source: data
                },
                label: {
                    show: true,
                    position: 'inside'
                },
                xAxis: {
                    type: 'category',
                    // data: data.dimensions
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    // data: data.source,
                    type: 'bar',
                    label: {
                        show: true,
                        formatter: '{@[2]}\n{@[3]}\n\n{@[1]}连板',
                        fontSize: 14,

                    }
                }]
            };

            if (option && typeof option === 'object') {
                myChart.setOption(option);
            }
        }
    </script>
</body>

</html>